<template>
  <div>
    <!-- name：应用名称, url：应用地址 -->
    <button @click="handleBack">返回</button>
    <button @click="handleSendGlobalData">修改全局数据：{ age: 19 }</button>
    <div class="sub-apps-container">
      <div id="sub-app-1-box" class="sub-app"></div>
    </div>
  </div>
</template>

<script lang="ts" setup>
// @ts-nocheck
import { action } from "@/main";
import { start } from "qiankun";
import { onMounted } from "vue";
import { useRouter } from "vue-router";

const router = useRouter();

const handleSendGlobalData = () => {
  action.setGlobalState({
    age: 19,
  });
};

const handleBack = () => {
  router.back();
};

onMounted(() => {
  if (!window.qiankunStarted) {
    start({
      sandbox: {
        experimentalStyleIsolation: true,
      },
    });
    window.qiankunStarted = true;
  }
});
</script>

<style></style>
